﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LanDBom.Models.Procure
{
    public class Find_WL
    {
        LDbaseEntities LD = new LDbaseEntities();
        public List<Formation> find_wl()
        {
            List<Formation> listwl = LD.Formation.ToList();
            return listwl;
        }
        public List<Formation> find_wl_ko()
        {
            List<Formation> listwl = LD.Formation.Where(x=>x.FM_kong=="待询价").ToList();
            return listwl;
        }
        public List<Formation> find_wl_name(string name)
        {
            List<Formation> listwl = LD.Formation.Where(x => x.FM_name == name).ToList();
            return listwl;
        }
        public int find_wlid(string Fo_id)
        {
            int x = LD.Formation.Where(z => z.FM_name == Fo_id).Count();
            if (x == 1)
            {
                Formation listwl = LD.Formation.Where( s=> s.FM_name == Fo_id).First();
                return listwl.FM_ID;
            }
            return -99;
        }

        public  Formation find_wl(string bian)
        {
            Formation formation = LD.Formation.Where(x => x.FM_bai == bian).First();
            return formation;
        }

        public string find_maname(int id)
        {
            mateial mateial = LD.mateial.Where(x => x.MA_ID == id).First();
            return mateial.MA_fne;
        }
        public parice find_ro(int id)
        {
            parice parice = LD.parice.Where(x => x.PA_ID == id).First();
            return parice;
        }

        internal List<Dengli> shenp( string youed)
        {
            //根据用户名查询级别并晒选级别高的人进行显示
            var shinflp=LD.Dengli.Where(s=>s.DE_nae.Contains(youed)).FirstOrDefault();
            var AA = shinflp.DE_zhiji;
            var AB = shinflp.DE_bumeng;
            var denglu = LD.Dengli.Where(s=>s.DE_zhiji<AA&&s.DE_zhiji!=null&&s.DE_bumeng==AB).ToList();
            return LD.Dengli.ToList();
        }
    }
}